import http from '@/utils/request'

export const apiGetFolderList = <T>(params?): Promise<T> => {
  return http({
    url: '/api/v1/folder',
    method: 'get',
    params
  })
}

export const apiGetMindList = <T>(params?): Promise<T> => {
  return http({
    url: '/api/v1/mind',
    method: 'get',
    params
  })
}

export const apiCreateMind = <T>(data?): Promise<T> => {
  return http({
    url: '/api/v1/mind',
    method: 'post',
    data
  })
}

export const apiCreateFolder = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/folder',
    method: 'post',
    data
  })
}

export const apiUpdateFolder = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/folder',
    method: 'put',
    data
  })
}

export const apiMindRename = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind/rename',
    method: 'post',
    data
  })
}

export const apiCollectMind = <T>(id: string): Promise<T> => {
  return http({
    url: '/api/v1/mind/collect',
    method: 'post',
    data: { id }
  })
}

export const apiUnCollectMind = <T>(id: string): Promise<T> => {
  return http({
    url: '/api/v1/mind/uncollect',
    method: 'put',
    data: { id }
  })
}

export const apiRecoverTrashFolder = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/folder/trash',
    method: 'post',
    data
  })
}

export const apiTrashFolder = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/folder/trash',
    method: 'put',
    data
  })
}

export const apiDeleteFolder = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/folder',
    method: 'delete',
    data
  })
}

export const apiRecoverTrashMind = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind/trash',
    method: 'post',
    data
  })
}

export const apiTrashMind = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind/trash',
    method: 'put',
    data
  })
}

export const apiDeleteMind = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind',
    method: 'delete',
    data
  })
}

export const apiGetFolderTreeList = <T>(params?): Promise<T> => {
  return http({
    url: '/api/v1/folder/tree',
    method: 'get',
    params
  })
}

export const apiMoveMindToFolder = <T>(data?): Promise<T> => {
  return http({
    url: '/api/v1/mind/move',
    method: 'post',
    data
  })
}

export const apiGetFolderUpPaths = <T>(id: string): Promise<T> => {
  return http({
    url: `/api/v1/folder/paths?id=${id}`,
    method: 'get'
  })
}

export const apiGetFolderTrashList = <T>(params): Promise<T> => {
  return http({
    url: '/api/v1/folder/trash',
    method: 'get',
    params
  })
}

export const apiGetMindTrashList = <T>(params): Promise<T> => {
  return http({
    url: '/api/v1/mind/trash',
    method: 'get',
    params
  })
}

export const apiGetUserCollectList = <T>(): Promise<T> => {
  return http({
    url: '/api/v1/mind/collect',
    method: 'get'
  })
}

export const apiGetMindPageList = <T>(params): Promise<T> => {
  return http({
    url: '/api/v1/mind/page',
    method: 'get',
    params
  })
}

export const apiGetMindStatisticCount = <T>(): Promise<T> => {
  return http({
    url: '/api/v1/mind/statistic',
    method: 'get'
  })
}

export const apiQueryUserProfileById = <T>(id: string): Promise<T> => {
  return http({
    url: `/api/v1/user/profile?id=${id}`,
    method: 'get'
  })
}

export const apiMindShare = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind/share',
    method: 'post',
    data
  })
}

export const apiGetMindShareList = <T>(params): Promise<T> => {
  return http({
    url: '/api/v1/mind/share/list',
    method: 'get',
    params
  })
}

export const apiGetMindShareToOtherList = <T>(params): Promise<T> => {
  return http({
    url: '/api/v1/mind/share-to-other/list',
    method: 'get',
    params
  })
}

export const apiRemoveMindShare = <T>(data): Promise<T> => {
  return http({
    url: '/api/v1/mind/share/remove',
    method: 'post',
    data
  })
}
